package com.pinyougou.manager.controller;


import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.HashMap;
import java.util.Map;

@RestController
public class LoginController {


    @RequestMapping("login")
    public Map findOnd(){
        //定义一个map
        HashMap map = new HashMap();
        //从环境上下文拿到用户名
        String name=SecurityContextHolder.getContext().getAuthentication().getName();
        //添加用户名
        map.put("name",name);
        return map;
    }
}
